package com.example.demo.zabbix.request.builder.host;

import com.example.demo.zabbix.request.BaseRequest;
import com.example.demo.zabbix.request.builder.request.RequestBuilder;

import java.util.HashMap;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/hostinterface/replacehostinterfaces
 */
public class HostInterfacesReplaceRequestBuilder extends RequestBuilder<Map<String,Object>> {
    private String hostId;
    private Map<String,Object> interfaces;
    public HostInterfacesReplaceRequestBuilder(String auth) {
        super("hostinterface.replacehostinterfaces", auth);
        baseRequest.setParams(new HashMap<>());
    }

    public HostInterfacesReplaceRequestBuilder(Long id, String auth) {
        super("hostinterface.replacehostinterfaces", id, auth);
        baseRequest.setParams(new HashMap<>());
    }

    public String getHostId() {
        return hostId;
    }

    public HostInterfacesReplaceRequestBuilder setHostId(String hostId) {
        this.hostId = hostId;
        return this;
    }

    public Map<String, Object> getInterfaces() {
        return interfaces;
    }

    public HostInterfacesReplaceRequestBuilder setInterfaces(Map<String, Object> interfaces) {
        this.interfaces = interfaces;
        return this;
    }

    public HostInterfacesReplaceRequestBuilder setParam(String key, Object value){
        baseRequest.getParams().put(key,value);
        return this;
    }

    public HostInterfacesReplaceRequestBuilder setParams(Map<String,Object> params){
        baseRequest.getParams().putAll(params);
        return this;
    }

    @Override
    public BaseRequest<Map<String, Object>> builder() {
        baseRequest.getParams().put("hostid",hostId);
        baseRequest.getParams().put("interfaces",interfaces);
        return baseRequest;
    }
}
